<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Timer</title>
		<script type="text/javascript" language="javascript">
			window.onload  = function(){
				showTime();
			};
			function showTime() {
				var time = new Date();
				time = time.toLocaleDateString() + time.toLocaleTimeString();
				document.getElementById("idclock").textContent = time;
				setTimeout("showTime()", 1000);
				/*setInterval("showTimer()", 1000); 使用这种方法的话词句不能写在方法体内,应写在调用处,不然浏览器崩溃 */
			}
		</script>
	</head>
	<body>
		<jsp:include page="/jspdemo/header.jsp" />
		<label id="idclock" style="color: red"></label>
		<%--
			out.println("<h1>"+Calendar.getInstance().getTime()+"</h1>");
			response.setHeader("Refresh","1");
		--%>
	</body>
</html>